package com.stx.jeepay.payment.model;

import com.stx.jeepay.core.entity.MchAppEntity;
import com.stx.jeepay.core.entity.MchInfoEntity;
import lombok.Data;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 *  商户配置信息
 *  放置到内存， 避免多次查询操作
 */
@Data
public class MchInfoConfigContext {

    /** 商户信息缓存 */
    private String mcnNo;

    private Byte mchType;

    private MchInfoEntity mchInfo;

    private Map<String, MchAppEntity> appMap = new ConcurrentHashMap<>();

    /** 重置商户APP **/
    public void putMchApp(MchAppEntity mchApp){
        appMap.put(mchApp.getAppId(), mchApp);
    }

    /** get商户APP **/
    public MchAppEntity getMchApp(String appId){
        return appMap.get(appId);
    }
}
